<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //  aabccd，去掉重复的字符，使结果显示 abcd

    var str = 'aabccd';
    var res = '';
    for(var i=0;i<str.length;i++){
        if(res.lastIndexOf(str[i]) == -1){
            res += str[i]
        }
    }
    console.log(res);
    
</script>
</html>